<?php

 $email=input('email');
 $password=input('password');
 $againpassword=input('againpassword');
 $username=input('username');
 $age=input('age');
 $sex=input('sex',1);
 $zhuxiu=input('zhuxiu',[]);
 $brithdate=input('brithdate');
 $shuxing=input('shuxing',1);
 $zwjs=input('zwjs');

 if (empty($email)) {
 	echo "<h1>邮箱不能为空</h1>";
 	header('Refresh:3,Url=table2.php');
 	return;

 }
 if (filter_input(INPUT_GET, "email", FILTER_VALIDATE_EMAIL)) {
    echo "<h1>邮箱格式不正确</h1>";
    header('Refresh:3,Url=table2.php');
 	return;
 }

 if (empty($password)||strlen($password)<6) {
 	echo "<h1>密码不能少于6位数</h1>";
 	header('Refresh:3,Url=table2.php');
 	return;
 }

 if ($password!=$againpassword) {
 	echo "<h1>输入的密码不一致</h1>";
 	header('Refresh:3,Url=table2.php');
 	return;
 }

 function input($name,$mr='')
 {
 	$value=$mr;
  if (isset($_POST[$name])) {
  	if (gettype($_POST[$name])=='string') {
  	$value=htmlspecialchars($_POST[$name]);
  	}else{
      $value=$_POST[$name];
  	}
  	return $value;

  }

 }
 ?>
 <!DOCTYPE html>
 <html>
 <head>
    <meta charset="utf-8">
 	<title>表单输出</title>
 </head>
 <body>
   <ul>
   	 <li>邮箱：<?=$email  ?></li>
   	 <li>密码：<?=$password  ?></li>
   	 <li>再次输入密码：<?=$againpassword  ?></li>
   	 <li>用户名：<?=$email  ?></li>
   	 <li>年龄：<?=$age ?></li>
   	 <li>性别：<?=$sex==1?'男':'女' ?></li>
   	 <li>主修科目：<?=implode(',', $zhuxiu) ?></li>
   	 <li>出生日期：<?=$brithdate ?></li>
   	 <li>属性：<?=$shuxing ?></li>
   	 <li>自我介绍：<?=$zwjs ?></li>
   </ul>
 </body>
 </html>